﻿package mortal.game.view.common.tooltip.tooltips
{
    import Message.DB.Tables.*;
    import com.gengine.utils.*;
    import com.mui.controls.*;
    import extend.language.*;
    import flash.text.*;
    import mortal.common.global.*;
    import mortal.common.text.*;
    import mortal.game.resource.*;
    import mortal.game.view.common.*;
    import mortal.game.view.common.tooltip.tooltips.base.*;

    public class ToolTipTitle extends ToolTipScaleBg
    {
        protected var _txtName:GTextFiled;
        protected var _attrLeft:AutoLayoutTextContainer;
        protected var _attrRight:AutoLayoutTextContainer;
        protected var _gainMethod:GTextFiled;
        protected var _gainBottom:AutoLayoutTextContainer;
        private var _data:Object;

        public function ToolTipTitle()
        {
            this.createChildren();
            return;
        }// end function

        protected function createChildren() : void
        {
            setBg(ImagesConst.ToolTipBg);
            this._txtName = UIFactory.gTextField(Language.getString(20857), 2, 0, 80, 20, this);
            this._attrLeft = new AutoLayoutTextContainer();
            this._attrLeft.x = 2;
            this._attrLeft.y = 30;
            this._attrLeft.verticalGap = -5;
            this.addChild(this._attrLeft);
            var _loc_1:int = 0;
            while (_loc_1 < 6)
            {
                
                this._attrLeft.addNewText(73, "", 12, 16777215);
                this._attrLeft.addNewText(73, "", 12, 16777215);
                this._attrLeft.addNewText(73, "", 12, 16777215);
                _loc_1++;
            }
            this._attrRight = new AutoLayoutTextContainer();
            this._attrRight.x = 82;
            this._attrRight.y = 30;
            this._attrRight.verticalGap = -5;
            this.addChild(this._attrRight);
            _loc_1 = 0;
            while (_loc_1 < 6)
            {
                
                this._attrRight.addNewText(73, "", 12, 16777215);
                this._attrRight.addNewText(73, "", 12, 16777215);
                this._attrRight.addNewText(73, "", 12, 16777215);
                _loc_1++;
            }
            this._gainMethod = UIFactory.gTextField(Language.getString(20858), 2, 150 - 3, 80, 20, this);
            this._gainBottom = new AutoLayoutTextContainer();
            this._gainBottom.x = 2;
            this._gainBottom.y = 150 + 10;
            this._gainBottom.addNewText(170 - 11, "", 12, GlobalStyle.colorLvUint, TextFieldAutoSize.LEFT, 1);
            this.addChild(this._gainBottom);
            return;
        }// end function

        override public function set data(param1) : void
        {
            var _loc_6:String = null;
            var _loc_7:int = 0;
            var _loc_8:String = null;
            super.data = param1;
            this._data = param1;
            var _loc_2:* = this._data.attrData as Array;
            var _loc_3:* = this._data.titleData as TTitle;
            var _loc_4:int = 0;
            while (_loc_4 < 6)
            {
                
                _loc_6 = _loc_2[_loc_4].attrName;
                _loc_7 = _loc_2[_loc_4].attrValue;
                if (_loc_7 == 0)
                {
                    _loc_8 = HTMLUtil.addColor(_loc_7 + "", GlobalStyle.colorBai);
                }
                else
                {
                    _loc_8 = HTMLUtil.addColor(_loc_7 + "", GlobalStyle.colorLv);
                }
                this._attrLeft.setText(_loc_4, _loc_6 + " " + _loc_8);
                _loc_4++;
            }
            _loc_4 = 6;
            while (_loc_4 < _loc_2.length)
            {
                
                _loc_6 = _loc_2[_loc_4].attrName;
                _loc_7 = _loc_2[_loc_4].attrValue;
                if (_loc_7 == 0)
                {
                    _loc_8 = HTMLUtil.addColor(_loc_7 + "", GlobalStyle.colorBai);
                }
                else
                {
                    _loc_8 = HTMLUtil.addColor(_loc_7 + "", GlobalStyle.colorLv);
                }
                this._attrRight.setText(_loc_4, _loc_6 + " " + _loc_8);
                _loc_4++;
            }
            var _loc_5:* = _loc_3.descStr == null ? ("") : (_loc_3.descStr);
            this._gainBottom.setText(0, _loc_5);
            _width = this._attrLeft.width + this._attrRight.width;
            _height = this._attrLeft.height + paddingBottom + paddingTop + this._gainBottom.height + 45;
            _scaleBg.setSize(170, _height);
            return;
        }// end function

    }
}
